package com.yxhl.zoume.core.user.ui.fragment.mywallet;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.yxhl.zoume.R;
import com.yxhl.zoume.UIConstants;
import com.yxhl.zoume.common.ui.fragment.BaseFragment;
import com.yxhl.zoume.core.user.ui.activity.MyWalletActivity;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * 项目名称：Ferrari
 * Created by menggod on 16/11/3 .
 */

public class WalletRechargeSuccessFragment extends BaseFragment {

    @BindView(R.id.tv_recharge_result_money)
    TextView mTvRechargeResultMoney;
    @BindView(R.id.btn_recharge_result)
    Button mBtnRechargeResult;

    public static WalletRechargeSuccessFragment newInstance(int rechargeMoney) {
        Bundle args = new Bundle();
        args.putSerializable(UIConstants.MyWallet.ARGUMENT_RECHARGE_MONEY, rechargeMoney);
        WalletRechargeSuccessFragment fragment = new WalletRechargeSuccessFragment();
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        parseArguments();
    }

    private void parseArguments() {
        Bundle arguments = getArguments();
        if (arguments != null) {
            int argumentsInt = arguments.getInt(UIConstants.MyWallet.ARGUMENT_RECHARGE_MONEY, 0);
            mTvRechargeResultMoney.setText("¥" + argumentsInt);
        }
    }

    @Override
    protected void initializeInjector() {

    }

    @Override
    protected int getLayoutResId() {
        return R.layout.fragment_recharge_success;
    }

    @Override
    protected void setupToolBar() {
        ((MyWalletActivity) mActivity).setToolbarTitle("账户充值");
    }


    @OnClick(R.id.btn_recharge_result)
    public void onClick() {
        mActivity.onBackPressed();
    }
}
